package com.han.bom;
import java.util.ArrayList;

/**
 * An instance of the Exam class, unlike PracticeExam, this exam is only active under a set duration.
 * All responses made by the student is taken and graded based on the correct answers and the answers given.
 * 
 * @author Adjell Ian Pabayos
 * 
 * @version 1.0
 * @since JDK 1.7
 * 
 * @see Exam
 * @see ExamThread
 *
 */

public class RealExam extends Exam{

	private long duration;
	private boolean activated;
	private int timesActivated;
	
	public int getTimesActivated() {
		return timesActivated;
	}
	public void setTimesActivated(int timesActivated) {
		this.timesActivated = timesActivated;
	}
	/**
	 * Default constructor. 
	 * Sets an empty name for the exam, and an empty list of questions.
	 */
	public RealExam() {
		this("", new ArrayList<Question>());
	}
	/**
	 * Constructor.
	 * Sets a given exam ID, but sets the name and list of questions to empty
	 * 
	 * @param examID - identifier of the exam
	 */
	public RealExam(int examID) {
		this("", new ArrayList<Question>());
	}
	/**
	 * Constructor.
	 * Sets a given ID using the exam name, and also sets the list of given questions
	 * 
	 * @param examName - name of the exam
	 * @param questions - list of questions to be included in the exam
	 */
	public RealExam(String examName, ArrayList<Question> questions) {
		super();
		setTotalNumExams(getTotalNumExams()+1);
		this.setExamID("E"+getTotalNumExams()+"RE");
		this.setExamName(examName);
		this.setQuestions(questions);
		this.activated = false;
		this.setDraft(true);
	}
	/* (non-Javadoc)
	 * @see com.chingstah.mob.Exam#getDuration()
	 */
	public long getDuration() {
		return duration;
	}
	/* (non-Javadoc)
	 * @see com.chingstah.mob.Exam#setDuration(int)
	 */
	public void setDuration(long duration) {
		this.duration = duration;
	}

	/**
	 * Gets the current status of the exam, returns true if it's currently active, false if otherwise.
	 * 
	 * @return
	 */
	public boolean isActivated() {
		return activated;
	}
	
	/**
	 * Sets the current status of the exam.
	 * Set to true if the exam can still be answered, false if otherwise.
	 * 
	 * @param activated - status of the exam, true or false if the exam can still be answered or not, respectively
	 */
	public void setActivated(boolean activated) {
		this.activated = activated;
		
	}
}
